package com.xiguaji.boot.eventbus;

import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;

import java.time.LocalDateTime;

import org.springframework.stereotype.Component;

@Component
public class ChangeEventListener implements IEventListener<ChangeEventListener.ChangeEvent> {

    @Subscribe
    @AllowConcurrentEvents
    public void handle(ChangeEvent event) {
        System.out.println(LocalDateTime.now() + " 2:" + Thread.currentThread().getName());
    }

    public static class ChangeEvent extends Event {

        public ChangeEvent() {
            super("ChangeEvent");
        }
    }
}
